Esempio n. 1
0
    def test_workspace_counter(self):
        instance = models.WorkspaceCounter()
        instance.workspace = CountryFactory.build(name=b'xyz')
        self.assertEqual(six.text_type(instance), u'xyz')

        instance = models.WorkspaceCounter()
        instance.workspace = CountryFactory.build(name=u'Magyarorsz\xe1g')
        self.assertEqual(six.text_type(instance), u'Magyarorsz\xe1g')
Esempio 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
Esempio n. 3
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='Country {}'.format(name.title()),
                                   schema_name=name,
                                   domain_url='{}.example.com'.format(name))
    country.vision_sync_enabled = True
    # We'll want to check vision_last_synced as part of the tests, so set it to a known value.
    country.vision_last_synced = None
    # We mock save() so we can see if it was called or not, also to prevent database changes.
    country.save = mock.Mock()

    return country
Esempio n. 4
0
 def test_vision_sync_log(self):
     country = CountryFactory.build(name='M\xe9xico',
                                    schema_name='Mexico',
                                    domain_url='mexico.example.com')
     instance = VisionSyncLog(country=country)
     self.assertTrue(six.text_type(instance).startswith(u'M\xe9xico'))
Esempio n. 5
0
    def test_country(self):
        instance = CountryFactory.build(name=b'xyz')
        self.assertEqual(six.text_type(instance), u'xyz')

        instance = CountryFactory.build(name=u'Magyarorsz\xe1g')
        self.assertEqual(six.text_type(instance), u'Magyarorsz\xe1g')