Exemplo n.º 1
0
 def test_create_language_with_right_data(self):
     "Should create a language given data by post"
     from labs.util import slugify
     language_name = u'Haskell'
     language_slug = slugify(language_name)
     self._mock_logged_in(times = 2)
     data = { 'name' : language_name }
     response = self.client.post('/admin/languages', data = data, follow_redirects = True)
     from labs.models import ProgrammingLanguage
     language = ProgrammingLanguage.all().filter('slug =', language_slug).get()
     assert_equals(language.name, language_name)
Exemplo n.º 2
0
 def test_create_a_unique_slug_to_a_duplicated_programming_language_name(self):
     "Should generate a new slug to a duplicated programming language"
     from labs.util import slugify
     language_name = u'Haskell'
     language_slug = slugify(language_name) + '-1'
     self._mock_logged_in(times = 4)
     data = { 'name' : language_name }
     response = self.client.post('/admin/languages', data = data, follow_redirects = True)
     response = self.client.post('/admin/languages', data = data, follow_redirects = True)
     from labs.models import ProgrammingLanguage
     language = ProgrammingLanguage.all().filter('slug =', language_slug).get()
     assert_equals(language.name, language_name)
Exemplo n.º 3
0
 def test_create_a_project(self):
     "Should create a project with given data by post"
     self._mock_logged_in(times = 2)
     expected_name = u'The project'
     from labs.util import slugify
     expected_slug = slugify(expected_name)
     data = {
         'name' : expected_name,
         'language' : self.language.key(),
         'description' : 'Bla bla bla'
     }
     response = self.client.post('/admin/projects', data = data, follow_redirects = True)
     from labs.models import Project
     project = Project.all().filter('slug = ', expected_slug).get()
     assert_equals(project.name, expected_name)
Exemplo n.º 4
0
def test_slugify_portuguese():
    "Should slugify a portuguese name"
    from labs.util import slugify
    assert_equals(slugify(u'Francisco Antônio da Silva Souza.'), u'francisco-antonio-da-silva-souza')
Exemplo n.º 5
0
def test_slugify_english():
    "Should slugify an english phrase"
    from labs.util import slugify
    assert_equals(slugify(u'My name is Francisco.'), u'my-name-is-francisco')