# Path: standup/status/tests/factories.py
# class StatusFactory(factory.django.DjangoModelFactory):
#     class Meta:
#         model = 'status.Status'
# 
#     created = fuzzy.FuzzyDateTime(
#         start_dt=datetime(2011, 9, 6, 0, 0, 0, tzinfo=pytz.utc)
#     )
#     user = factory.SubFactory(StandupUserFactory)
#     project = factory.SubFactory(ProjectFactory)
#     content = factory.Faker('sentence')
# 
# class StandupUserFactory(factory.django.DjangoModelFactory):
#     class Meta:
#         model = 'status.StandupUser'
# 
#     user = factory.SubFactory(UserFactory)
#     slug = factory.LazyAttribute(lambda obj: slugify(obj.user.username))
#     irc_nick = factory.Faker('user_name')
#     # FIXME: teams


import pytest
from standup.status.tests.factories import StatusFactory, StandupUserFactory



@pytest.mark.django_db()
def test_tags():
    """Test that format update parses tags correctly"""

    # Test valid tags.
    for tag in ('#t', '#tag', '#TAG', '#tag123'):
        expected = '<p><span class="tag tag-%s">%s</span></p>' % (tag[1:].lower(), tag)
        assert StatusFactory(content=tag).htmlify() == expected

    # Test invalid tags. Not first b/c markdown.
    for tag in ('tag #1', 'tag #.abc', 'tag #?abc'):

# Path: standup/status/tests/factories.py
# class StatusFactory(factory.django.DjangoModelFactory):
#     class Meta:
#         model = 'status.Status'
# 
#     created = fuzzy.FuzzyDateTime(
#         start_dt=datetime(2011, 9, 6, 0, 0, 0, tzinfo=pytz.utc)
#     )
#     user = factory.SubFactory(StandupUserFactory)
#     project = factory.SubFactory(ProjectFactory)
#     content = factory.Faker('sentence')
# 
# class StandupUserFactory(factory.django.DjangoModelFactory):
#     class Meta:
#         model = 'status.StandupUser'
# 
#     user = factory.SubFactory(UserFactory)
#     slug = factory.LazyAttribute(lambda obj: slugify(obj.user.username))
#     irc_nick = factory.Faker('user_name')
#     # FIXME: teams


# Path: standup/status/tests/test_models.py
import pytest
from standup.status.tests.factories import StatusFactory, StandupUserFactory




@pytest.mark.django_db()
def test_tags():
    """Test that format update parses tags correctly"""

    # Test valid tags.
    for tag in ('#t', '#tag', '#TAG', '#tag123'):
        expected = '<p><span class="tag tag-%s">%s</span></p>' % (tag[1:].lower(), tag)
        assert StatusFactory(content=tag).htmlify() == expected

    # Test invalid tags. Not first b/c markdown.
    for tag in ('tag #1', 'tag #.abc', 'tag #?abc'):

        assert StatusFactory(content=tag).htmlify() == '<p>%s</p>' % tag