Exemplo n.º 1
0
    def test_workspace_counter(self):
        instance = models.WorkspaceCounter()
        instance.workspace = CountryFactory.build(name='xyz')
        self.assertEqual(str(instance), 'xyz')

        instance = models.WorkspaceCounter()
        instance.workspace = CountryFactory.build(name='Magyarorsz\xe1g')
        self.assertEqual(str(instance), 'Magyarorsz\xe1g')
Exemplo n.º 2
0
def _build_country(name):
    '''Given a name (e.g. 'test1'), creates a Country object via FactoryBoy. The object is not saved to the database.
    It exists only in memory. We must be careful not to save this because creating a new Country in the database
    complicates schemas.
    '''
    country = CountryFactory.build(name=u'Country {}'.format(name.title()),
                                   schema_name=name,
                                   domain_url=u'{}.example.com'.format(name))
    # Mock save() to prevent inadvertent database changes.
    country.save = mock.Mock()

    return country
Exemplo n.º 3
0
    def test_country(self):
        instance = CountryFactory.build(name='xyz')
        self.assertEqual(str(instance), 'xyz')

        instance = CountryFactory.build(name='Magyarorsz\xe1g')
        self.assertEqual(str(instance), 'Magyarorsz\xe1g')
Exemplo n.º 4
0
 def test_vision_sync_log(self):
     country = CountryFactory.build(name='M\xe9xico', schema_name='Mexico')
     instance = VisionSyncLog(country=country)
     self.assertTrue(str(instance).startswith('M\xe9xico'))