| 187 | // #[actix_web::test] |
| 188 | #[allow(dead_code)] |
| 189 | fn update_simple_fixtures() { |
| 190 | let f = Fixtures::copy("simple"); |
| 191 | let root = ExternalId::root_topic(); |
| 192 | let repo_id = RepoId::wiki(); |
| 193 | |
| 194 | let topic_path = |
| 195 | parse_id("dPqrU4sZaPkNZEDyr9T68G4RJYV8bncmIXumedBNls9F994v8poSbxTo7dKK3Vhi"); |
| 196 | let UpsertTopicResult { repo_topic, .. } = UpsertTopic { |
| 197 | actor: actor(), |
| 198 | locale: Locale::EN, |
| 199 | name: "Climate change".to_owned(), |
| 200 | repo_id, |
| 201 | on_matching_synonym: OnMatchingSynonym::Update(topic_path), |
| 202 | parent_topic_id: root.clone(), |
| 203 | } |
| 204 | .call(f.mutation(), &redis::Noop) |
| 205 | .unwrap(); |
| 206 | let climate_change = repo_topic.unwrap(); |
| 207 | |
| 208 | let url = RepoUrl::parse("https://en.wikipedia.org/wiki/Climate_change").unwrap(); |
| 209 | let result = f.upsert_link( |
| 210 | repo_id, |
| 211 | &url, |
| 212 | Some("Climate change".into()), |
| 213 | Some(climate_change.topic_id().to_owned()), |
| 214 | ); |
| 215 | println!("result: {:?}", result.link); |
| 216 | |
| 217 | let topic_id = parse_id("wxy3RN6zm8BJKr6kawH3ekvYwwYT5EEgIhm5nrRD69qm7audRylxmZSNY39Aa1Gj"); |
| 218 | let UpsertTopicResult { repo_topic, .. } = UpsertTopic { |
| 219 | actor: actor(), |
| 220 | locale: Locale::EN, |
| 221 | name: "Weather".to_owned(), |
| 222 | repo_id: RepoId::wiki(), |
| 223 | on_matching_synonym: OnMatchingSynonym::Update(topic_id), |
| 224 | parent_topic_id: root, |
| 225 | } |
| 226 | .call(f.mutation(), &redis::Noop) |
| 227 | .unwrap(); |
| 228 | let weather = repo_topic.unwrap(); |
| 229 | |
| 230 | let url = RepoUrl::parse("https://en.wikipedia.org/wiki/Weather").unwrap(); |
| 231 | f.upsert_link( |
| 232 | repo_id, |
| 233 | &url, |
| 234 | Some("Weather".into()), |
| 235 | Some(weather.topic_id().to_owned()), |
| 236 | ); |
| 237 | |
| 238 | let topic_id = parse_id("F7EddRg9OPuLuk2oRMlO0Sm1v4OxgxQvzB3mRZxGfrqQ9dXjD4QKD6wuxOxucP13"); |
| 239 | let UpsertTopicResult { repo_topic, .. } = UpsertTopic { |
| 240 | actor: actor(), |
| 241 | locale: Locale::EN, |
| 242 | name: "Climate change and weather".to_owned(), |
| 243 | repo_id, |
| 244 | on_matching_synonym: OnMatchingSynonym::Update(topic_id), |
| 245 | parent_topic_id: climate_change.topic_id().to_owned(), |
| 246 | } |