def simple_app(self, postgresql): app = models.App( name=randchars(), repo_url=randchars(), repo_type=randchars(), ) app.save() return app
def test_build_unusable_status(gridfs): app_url = randurl() a = models.App(name=randchars(), repo_url=app_url, repo_type='hg') a.save() with somefile() as f: b = models.Build( app=a, tag='blah', start_time=timezone.now() - relativedelta(minutes=2), end_time=timezone.now() - relativedelta(minutes=1), file=File(f), status='', ) b.save() assert b.is_usable() is False
def test_release_config_marshaling(postgresql): app = models.App(name=randchars(), repo_url=randchars(), repo_type='git') app.save() b = models.Build( app=app, tag=randchars(), ) b.save() release = models.Release( build=b, config_yaml=None, # numbers can only be 32 bit in xmlrpc env_yaml='FACEBOOK_APP_ID: 1234123412341234') with pytest.raises(ValidationError): release.save()
def setup_method(self, method): self.app = models.App( name=randchars(), repo_url=randchars(), repo_type=randchars(), ) self.app.save() self.build = models.Build( app=self.app, tag=randchars(), file=randchars(), status='success', hash=randchars(), ) self.build.save() self.release = models.Release( build=self.build, config_yaml='', env_yaml='', hash=randchars(), ) self.release.save() self.squad = models.Squad(name=randchars()) self.squad.save() # create a swarm object self.swarm = models.Swarm( app=self.app, release=self.release, config_name=randchars(), proc_name='web', squad=self.squad, ) self.swarm.save() # Get a logged in client ready self.user = get_user() self.client = Client() data = dict(username=self.user.username, password='******') self.client.post(reverse('login'), data)
def test_swarm_config_marshaling(postgresql): app = models.App(name=randchars(), repo_url=randchars(), repo_type='git') app.save() b = models.Build( app=app, tag=randchars(), ) b.save() release = models.Release(build=b, ) release.save() squad = models.Squad(name=randchars()) swarm = models.Swarm( app=app, release=release, config_name=randchars(), proc_name=randchars(), squad=squad, config_yaml='1: integer key!', ) with pytest.raises(ValidationError): swarm.save()
def setup(self): self.app = models.App( name=randchars(), repo_url=randchars(), repo_type=randchars(), ) self.app.save() self.app2 = models.App( name=randchars(), repo_url=randchars(), repo_type=randchars(), ) self.app2.save() self.build = models.Build( app=self.app, tag=randchars(), file=randchars(), status='success', hash=randchars(), ) self.build.save() self.build2 = models.Build( app=self.app2, tag=randchars(), file=randchars(), status='success', hash=randchars(), ) self.build2.save() self.release = models.Release( build=self.build, config_yaml='', env_yaml='', hash=randchars(), ) self.release.save() self.release2 = models.Release( build=self.build2, config_yaml='', env_yaml='', hash=randchars(), ) self.release2.save() self.squad = models.Squad(name=randchars()) self.squad.save() # create a swarm object self.swarm = models.Swarm( app=self.app, release=self.release, config_name=randchars(), proc_name='web', squad=self.squad, ) self.swarm.save() self.swarm2 = models.Swarm( app=self.app2, release=self.release2, config_name=randchars(), proc_name='web', squad=self.squad, ) self.swarm2.save() dashboard_name = randchars() self.dashboard = models.Dashboard( name=dashboard_name, slug=slugify(dashboard_name), ) self.dashboard.save() self.dashboard.apps.add(self.app2) # Get a logged in client ready self.user = get_user() models.UserProfile.objects.create(user=self.user) self.user.userprofile.default_dashboard = self.dashboard self.user.userprofile.save() self.client = Client() self.client.post(reverse('login'), { 'username': self.user.username, 'password': '******' })