def test_simple(self): serializer = OrganizationReleaseSerializer( data={ 'ref': self.ref, 'url': self.url, 'dateReleased': self.dateReleased, 'commits': self.commits, 'headCommits': self.headCommits, 'refs': self.refs, }) assert serializer.is_valid() assert sorted(serializer.fields.keys()) == sorted( ['ref', 'url', 'dateReleased', 'commits', 'headCommits', 'refs']) result = serializer.validated_data assert result['ref'] == self.ref assert result['url'] == self.url assert result['dateReleased'] == datetime(1000, 10, 10, 6, 6, tzinfo=pytz.UTC) assert result['commits'] == self.commits assert result['headCommits'] == self.headCommits assert result['refs'] == self.refs
def test_simple(self): serializer = OrganizationReleaseSerializer( data={ "ref": self.ref, "url": self.url, "dateReleased": self.dateReleased, "commits": self.commits, "headCommits": self.headCommits, "refs": self.refs, }) assert serializer.is_valid() assert set(serializer.fields.keys()) == { "ref", "url", "dateReleased", "commits", "headCommits", "refs", "status", } result = serializer.validated_data assert result["ref"] == self.ref assert result["url"] == self.url assert result["dateReleased"] == datetime(1000, 10, 10, 6, 6, tzinfo=pytz.UTC) assert result["commits"] == self.commits assert result["headCommits"] == self.headCommits assert result["refs"] == self.refs
def test_author_email_patch(self): serializer = OrganizationReleaseSerializer(data={ "commits": [{ "id": "a", "author_email": "email[test]@example.org" }] }) assert serializer.is_valid()
def test_ref_limited_by_max_version_length(self): serializer = OrganizationReleaseSerializer(data={ 'ref': 'a' * VERSION_LENGTH, }) assert serializer.is_valid() serializer = OrganizationReleaseSerializer(data={ 'ref': 'a' * (VERSION_LENGTH + 1), }) assert not serializer.is_valid()
def test_simple(self): serializer = OrganizationReleaseSerializer(data={ 'ref': self.ref, 'url': self.url, 'dateReleased': self.dateReleased, 'commits': self.commits, 'headCommits': self.headCommits, 'refs': self.refs, }) assert serializer.is_valid() assert sorted(serializer.fields.keys()) == sorted( ['ref', 'url', 'dateReleased', 'commits', 'headCommits', 'refs']) result = serializer.object assert result['ref'] == self.ref assert result['url'] == self.url assert result['dateReleased'] == datetime(1000, 10, 10, 6, 6) assert result['commits'] == self.commits assert result['headCommits'] == self.headCommits assert result['refs'] == self.refs
def test_ref_limited_by_max_version_length(self): serializer = OrganizationReleaseSerializer( data={"ref": "a" * MAX_VERSION_LENGTH}) assert serializer.is_valid() serializer = OrganizationReleaseSerializer( data={"ref": "a" * (MAX_VERSION_LENGTH + 1)}) assert not serializer.is_valid()
def test_ref_limited_by_max_version_length(self): serializer = OrganizationReleaseSerializer(data={ 'ref': 'a' * VERSION_LENGTH, }) assert serializer.is_valid() serializer = OrganizationReleaseSerializer( data={ 'ref': 'a' * (VERSION_LENGTH + 1), }) assert not serializer.is_valid()
def test_do_not_allow_null_refs(self): serializer = OrganizationReleaseSerializer(data={"refs": None}) assert not serializer.is_valid()
def test_do_not_allow_null_head_commits(self): serializer = OrganizationReleaseSerializer(data={"headCommits": None}) assert not serializer.is_valid()
def test_fields_not_required(self): serializer = OrganizationReleaseSerializer(data={}) assert serializer.is_valid()
def test_do_not_allow_null_commits(self): serializer = OrganizationReleaseSerializer(data={ 'commits': None, }) assert not serializer.is_valid()
def test_do_not_allow_null_refs(self): serializer = OrganizationReleaseSerializer(data={ 'refs': None, }) assert not serializer.is_valid()
def test_do_not_allow_null_head_commits(self): serializer = OrganizationReleaseSerializer(data={ 'headCommits': None, }) assert not serializer.is_valid()
def test_fields_not_required(self): serializer = OrganizationReleaseSerializer(data={}) assert serializer.is_valid()