[mb-commits] branch, mbs-3072-json-work-type, created. MBS-3072, update tests with work type changes to test data.

MusicBrainz Git Server <[email protected]>
Newsgroups gmane.comp.audio.musicbrainz.cvs
Message-ID <E1Tfq3x-00070v-GQ@wiley>
The branch, mbs-3072-json-work-type has been created
        at  d98ce0ac17d005ecfc21984951c9c7d4a3522280 (commit)

- Log -----------------------------------------------------------------
commit d98ce0ac17d005ecfc21984951c9c7d4a3522280
Author: warp <[email protected]>
Date:   Tue Dec 4 11:48:24 2012 +0100

    MBS-3072, update tests with work type changes to test data.

diff --git a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseWorks.pm b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseWorks.pm
index 666f520..f384a56 100644
--- a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseWorks.pm
+++ b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/BrowseWorks.pm
@@ -25,6 +25,7 @@ test 'browse works via artist (first page)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "2734cd31-4bab-3bf6-a758-c5d94ad957bb",
@@ -32,6 +33,7 @@ test 'browse works via artist (first page)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "294f16fe-e123-3634-a0f4-03953e111321",
@@ -39,6 +41,7 @@ test 'browse works via artist (first page)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "37814c05-f7ff-308d-a339-21570bc56003",
@@ -46,6 +49,7 @@ test 'browse works via artist (first page)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "3a62a9f7-1365-32aa-9da8-3e0ef1f2b0ca",
@@ -53,6 +57,7 @@ test 'browse works via artist (first page)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 }]
         });
 };
@@ -74,6 +79,7 @@ test 'browse works via artist (second page)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "482530c1-a2ab-32e8-be43-ea5240aa7913",
@@ -81,6 +87,7 @@ test 'browse works via artist (second page)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "93836f17-7646-374e-a679-455429162c20",
@@ -88,6 +95,7 @@ test 'browse works via artist (second page)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "e67f54be-a68b-351d-9fbf-57468e61fd95",
@@ -95,6 +103,7 @@ test 'browse works via artist (second page)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "f4f581d8-50e0-3886-bcd3-610187821bcd",
@@ -102,6 +111,7 @@ test 'browse works via artist (second page)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 }]
         });
 };
diff --git a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupArtist.pm b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupArtist.pm
index fd5e547..5aaaf0c 100644
--- a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupArtist.pm
+++ b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupArtist.pm
@@ -516,6 +516,7 @@ test 'artist lookup with works (using l_artist_work)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 }
             ]
         });
@@ -546,6 +547,7 @@ test 'artist lookup with works (using l_recording_work)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "2d967c29-63dc-309d-bbc1-a2d38639aaa1",
@@ -553,6 +555,7 @@ test 'artist lookup with works (using l_recording_work)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "303f9bd2-152f-3145-9e09-afa34edb6a57",
@@ -560,6 +563,7 @@ test 'artist lookup with works (using l_recording_work)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "46724ef1-241e-3d7f-9f3b-e51ba34e2aa1",
@@ -567,6 +571,7 @@ test 'artist lookup with works (using l_recording_work)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "4b6a46c2-a904-3471-9bff-3942d4549f47",
@@ -574,6 +579,7 @@ test 'artist lookup with works (using l_recording_work)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "50c07b24-7ee2-31ac-ab87-f0d399011c71",
@@ -581,6 +587,7 @@ test 'artist lookup with works (using l_recording_work)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "511f5124-c0ae-3386-bb76-4b6521498a68",
@@ -588,6 +595,7 @@ test 'artist lookup with works (using l_recording_work)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "53d1fbac-e60a-38cb-85ff-e5a9224c9749",
@@ -595,6 +603,7 @@ test 'artist lookup with works (using l_recording_work)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "61ab56f0-e803-3aef-a91b-63564b7a8043",
@@ -602,6 +611,7 @@ test 'artist lookup with works (using l_recording_work)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "6f08d5a8-1811-3e5e-848b-35ffa77babe5",
@@ -609,6 +619,7 @@ test 'artist lookup with works (using l_recording_work)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "7981d409-8e76-33df-be27-ef625d81c501",
@@ -616,6 +627,7 @@ test 'artist lookup with works (using l_recording_work)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "7e78f281-52b4-315b-9d7b-6d215732f3d7",
@@ -623,6 +635,7 @@ test 'artist lookup with works (using l_recording_work)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "cd86f9e2-83ce-3192-a817-fe6c98079303",
@@ -630,6 +643,7 @@ test 'artist lookup with works (using l_recording_work)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "d2f1ea1f-de2e-3d0c-b534-e96377912478",
@@ -637,6 +651,7 @@ test 'artist lookup with works (using l_recording_work)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 },
                 {
                     id => "f23ae726-0300-3830-b1ca-634f4362f78c",
@@ -644,6 +659,7 @@ test 'artist lookup with works (using l_recording_work)' => sub {
                     disambiguation => "",
                     iswcs => [],
                     language => JSON::null,
+                    type => JSON::null,
                 }]
         });
 };
diff --git a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupWork.pm b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupWork.pm
index ee6b321..4243441 100644
--- a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupWork.pm
+++ b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupWork.pm
@@ -25,8 +25,8 @@ test 'basic work lookup' => sub {
             title => "サマーれげぇ!レインボー",
             disambiguation => "",
             iswcs => [ "T-000.000.002-0" ],
-            type => 'Song',
             language => 'jpn',
+            type => 'Song',
         });
 };
 
@@ -45,6 +45,7 @@ test 'basic work lookup, inc=annotation' => sub {
             annotation => "this is a work annotation",
             iswcs => [ ],
             language => JSON::null,
+            type => JSON::null,
         });
 };
 
@@ -70,6 +71,7 @@ test 'work lookup via iswc' => sub {
                     disambiguation => "",
                     iswcs => [ "T-000.000.002-0" ],
                     language => 'jpn',
+                    type => "Song",
                 }]
         });
 };
@@ -108,6 +110,7 @@ test 'work lookup with recording relationships' => sub {
                 ],
             iswcs => [],
             language => 'jpn',
+            type => "Song",
         });
 
 };
diff --git a/t/lib/t/MusicBrainz/Server/Controller/WS/2/LookupWork.pm b/t/lib/t/MusicBrainz/Server/Controller/WS/2/LookupWork.pm
index 02152e4..267e253 100644
--- a/t/lib/t/MusicBrainz/Server/Controller/WS/2/LookupWork.pm
+++ b/t/lib/t/MusicBrainz/Server/Controller/WS/2/LookupWork.pm
@@ -30,7 +30,7 @@ ws_test 'basic work lookup',
     '/work/3c37b9fa-a6c1-37d2-9e90-657a116d337c' =>
     '<?xml version="1.0"?>
 <metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#">
-  <work id="3c37b9fa-a6c1-37d2-9e90-657a116d337c">
+  <work id="3c37b9fa-a6c1-37d2-9e90-657a116d337c" type="Song">
     <title>サマーれげぇ!レインボー</title>
     <language>jpn</language>
     <iswc>T-000.000.002-0</iswc>
@@ -53,7 +53,7 @@ ws_test 'work lookup via iswc',
     '<?xml version="1.0"?>
 <metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#">
   <work-list count="1">
-    <work id="3c37b9fa-a6c1-37d2-9e90-657a116d337c">
+    <work id="3c37b9fa-a6c1-37d2-9e90-657a116d337c" type="Song">
       <title>サマーれげぇ!レインボー</title>
       <language>jpn</language>
       <iswc>T-000.000.002-0</iswc>
@@ -66,7 +66,7 @@ ws_test 'work lookup with recording relationships',
     '/work/3c37b9fa-a6c1-37d2-9e90-657a116d337c?inc=recording-rels' =>
     '<?xml version="1.0"?>
 <metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#">
-  <work id="3c37b9fa-a6c1-37d2-9e90-657a116d337c">
+  <work id="3c37b9fa-a6c1-37d2-9e90-657a116d337c" type="Song">
     <title>サマーれげぇ!レインボー</title>
     <language>jpn</language>
     <iswc>T-000.000.002-0</iswc>

commit 7cb5e289eb93fe29df1801ac72a8c8d67caf43bf
Author: Aurélien Mino <[email protected]>
Date:   Mon Dec 3 21:04:40 2012 +0100

    Revert previous work comment change.

diff --git a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupWork.pm b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupWork.pm
index 1a24534..ee6b321 100644
--- a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupWork.pm
+++ b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupWork.pm
@@ -23,7 +23,7 @@ test 'basic work lookup' => sub {
         {
             id => "3c37b9fa-a6c1-37d2-9e90-657a116d337c",
             title => "サマーれげぇ!レインボー",
-            disambiguation => "xyz",
+            disambiguation => "",
             iswcs => [ "T-000.000.002-0" ],
             type => 'Song',
             language => 'jpn',
@@ -67,7 +67,7 @@ test 'work lookup via iswc' => sub {
                 {
                     id => "3c37b9fa-a6c1-37d2-9e90-657a116d337c",
                     title => "サマーれげぇ!レインボー",
-                    disambiguation => "xyz",
+                    disambiguation => "",
                     iswcs => [ "T-000.000.002-0" ],
                     language => 'jpn',
                 }]
@@ -83,7 +83,7 @@ test 'work lookup with recording relationships' => sub {
         {
             id => "3c37b9fa-a6c1-37d2-9e90-657a116d337c",
             title => "サマーれげぇ!レインボー",
-            disambiguation => "xyz",
+            disambiguation => "",
             relations => [
                 {
                     type => "performance",
diff --git a/t/sql/webservice.sql b/t/sql/webservice.sql
index 8700f3d..f7612ef 100644
--- a/t/sql/webservice.sql
+++ b/t/sql/webservice.sql
@@ -3572,7 +3572,7 @@ INSERT INTO link (begin_date_day, attribute_count, begin_date_year, created, lin
 INSERT INTO l_recording_release (link, last_updated, entity1, entity0, edits_pending, id) VALUES (6059, '2011-01-18 15:56:00.408782+00', 459740, 7905440, 0, 1);
 INSERT INTO work_type (name, id) VALUES ('Song', 17);
 INSERT INTO work_name (name, id) VALUES ('サマーれげぇ!レインボー', 28109);
-INSERT INTO work (last_updated, name, edits_pending, artist_credit, comment, id, type, gid, language) VALUES (NULL, 28109, 0, NULL, 'xyz', 4223059, 17, '3c37b9fa-a6c1-37d2-9e90-657a116d337c', 198);
+INSERT INTO work (last_updated, name, edits_pending, artist_credit, comment, id, type, gid, language) VALUES (NULL, 28109, 0, NULL, '', 4223059, 17, '3c37b9fa-a6c1-37d2-9e90-657a116d337c', 198);
 UPDATE work_meta SET rating_count = NULL, rating = NULL WHERE id = 4223059;
 INSERT INTO link_type (priority, last_updated, parent, name, description, short_link_phrase, link_phrase, entity_type1, entity_type0, id, reverse_link_phrase, child_order, gid) VALUES (0, '2011-01-18 15:31:00.495651+00', NULL, 'performance', '', 'performance', 'is a performance of', 'work', 'recording', 285, 'has performance', 0, 'fdc57134-e05c-30bc-aff6-425684475276');
 INSERT INTO link (begin_date_day, attribute_count, begin_date_year, created, link_type, end_date_day, begin_date_month, end_date_month, id, end_date_year) VALUES (NULL, 0, NULL, '2011-01-18 15:31:00.495651+00', 285, NULL, NULL, NULL, 23865, NULL);

commit f20513a87abb8a9b3618821d15159e5b72d32138
Author: Aurélien Mino <[email protected]>
Date:   Sun Dec 2 22:38:29 2012 +0100

    MBS-3072, work type should be included in the /ws/2 json output.

diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Work.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Work.pm
index 1ad8b90..6195905 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Work.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Work.pm
@@ -19,6 +19,7 @@ sub serialize
     $body{title} = $entity->name;
     $body{disambiguation} = $entity->comment // "";
     $body{iswcs} = [ map { $_->iswc } @{ $entity->iswcs } ];
+    $body{type} = $entity->type ? $entity->type->name : JSON::null;
 
     $body{language} = $entity->language
         ? $entity->language->iso_code_3 // $entity->language->iso_code_2t
diff --git a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupWork.pm b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupWork.pm
index a161ff0..1a24534 100644
--- a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupWork.pm
+++ b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupWork.pm
@@ -23,8 +23,9 @@ test 'basic work lookup' => sub {
         {
             id => "3c37b9fa-a6c1-37d2-9e90-657a116d337c",
             title => "サマーれげぇ!レインボー",
-            disambiguation => "",
+            disambiguation => "xyz",
             iswcs => [ "T-000.000.002-0" ],
+            type => 'Song',
             language => 'jpn',
         });
 };
@@ -66,7 +67,7 @@ test 'work lookup via iswc' => sub {
                 {
                     id => "3c37b9fa-a6c1-37d2-9e90-657a116d337c",
                     title => "サマーれげぇ!レインボー",
-                    disambiguation => "",
+                    disambiguation => "xyz",
                     iswcs => [ "T-000.000.002-0" ],
                     language => 'jpn',
                 }]
@@ -82,7 +83,7 @@ test 'work lookup with recording relationships' => sub {
         {
             id => "3c37b9fa-a6c1-37d2-9e90-657a116d337c",
             title => "サマーれげぇ!レインボー",
-            disambiguation => "",
+            disambiguation => "xyz",
             relations => [
                 {
                     type => "performance",
diff --git a/t/sql/webservice.sql b/t/sql/webservice.sql
index ab3908a..8700f3d 100644
--- a/t/sql/webservice.sql
+++ b/t/sql/webservice.sql
@@ -3570,8 +3570,9 @@ INSERT INTO l_recording_recording (link, last_updated, entity1, entity0, edits_p
 INSERT INTO link_type (priority, last_updated, parent, name, description, short_link_phrase, link_phrase, entity_type1, entity_type0, id, reverse_link_phrase, child_order, gid) VALUES (0, '2011-01-18 15:31:00.495651+00', NULL, 'samples material', 'Indicates that a track contains samples from an album. (<a href="http://musicbrainz.org/doc/Samples_Relationship_Type">Details</a>)', 'samples material', '{additional} {instrument} samples from', 'release', 'recording', 71, '{additional:additionally} {instrument} sampled by', 0, '967746f9-9d79-456c-9d1e-50116f0b27fc');
 INSERT INTO link (begin_date_day, attribute_count, begin_date_year, created, link_type, end_date_day, begin_date_month, end_date_month, id, end_date_year) VALUES (NULL, 0, 2008, '2011-01-18 15:31:00.495651+00', 71, NULL, NULL, NULL, 6059, NULL);
 INSERT INTO l_recording_release (link, last_updated, entity1, entity0, edits_pending, id) VALUES (6059, '2011-01-18 15:56:00.408782+00', 459740, 7905440, 0, 1);
+INSERT INTO work_type (name, id) VALUES ('Song', 17);
 INSERT INTO work_name (name, id) VALUES ('サマーれげぇ!レインボー', 28109);
-INSERT INTO work (last_updated, name, edits_pending, artist_credit, comment, id, type, gid, language) VALUES (NULL, 28109, 0, NULL, '', 4223059, NULL, '3c37b9fa-a6c1-37d2-9e90-657a116d337c', 198);
+INSERT INTO work (last_updated, name, edits_pending, artist_credit, comment, id, type, gid, language) VALUES (NULL, 28109, 0, NULL, 'xyz', 4223059, 17, '3c37b9fa-a6c1-37d2-9e90-657a116d337c', 198);
 UPDATE work_meta SET rating_count = NULL, rating = NULL WHERE id = 4223059;
 INSERT INTO link_type (priority, last_updated, parent, name, description, short_link_phrase, link_phrase, entity_type1, entity_type0, id, reverse_link_phrase, child_order, gid) VALUES (0, '2011-01-18 15:31:00.495651+00', NULL, 'performance', '', 'performance', 'is a performance of', 'work', 'recording', 285, 'has performance', 0, 'fdc57134-e05c-30bc-aff6-425684475276');
 INSERT INTO link (begin_date_day, attribute_count, begin_date_year, created, link_type, end_date_day, begin_date_month, end_date_month, id, end_date_year) VALUES (NULL, 0, NULL, '2011-01-18 15:31:00.495651+00', 285, NULL, NULL, NULL, 23865, NULL);

-----------------------------------------------------------------------


hooks/post-receive
-- 
mb_server

_______________________________________________
MusicBrainz-commits mailing list
[email protected]
http://lists.musicbrainz.org/mailman/listinfo/musicbrainz-commits
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.